﻿using System.Data.Entity;
using Model.Core.DataBase;
using Model.Core.DataBase.EntityFramework;
using Web.Models.AnalysisData;
using Web.Models.CoreData;
using Web.Models.VersionData;

namespace Web.Models
{
    /// <summary>
    ///     数据源工厂用于可获得数据源的容器
    /// </summary>
    public static class ContainerFactory
    {

        /// <summary>
        ///     业务逻辑（业务）的数据库连接
        /// </summary>
        public static IDbContext OpenAnalysisConnect()
        {
            return DbContextFactory.CreateEntityFrameworkContext(typeof(AnalysisContainer), "AnalysisData");
        }

        /// <summary>
        ///     业务逻辑（业务）的数据库连接
        /// </summary>
        public static IDbContext OpenCoreConnect()
        {
            return DbContextFactory.CreateEntityFrameworkContext(typeof(CoreContainer), "CoreData");
        }

        /// <summary>
        ///     业务逻辑（业务）的数据库连接
        /// </summary>
        public static IDbContext OpenVersionConnect()
        {
            return null;
        }
    }

    
    //public class VersionContainer : BaseContainer
    //{
    //    public VersionContainer(string dbConnectName)
    //        : base(dbConnectName)
    //    {

    //    }

    //    #region Example:public DbSet<YourClassName> YourClassName { get; set; }
            
    //    #region Table

    //    public DbSet<VersionLib> VersionLib { get; set; }



    //    #endregion

    //    #endregion
    //}

    public class AnalysisContainer : BaseContainer
    {
        public AnalysisContainer(string dbConnectName)
            : base(dbConnectName)
        {

        }

        #region Example:public DbSet<YourClassName> YourClassName { get; set; }

        #region Table

        public DbSet<ReportAnalysis> ReportAnalysis { get; set; }

        #endregion

        #endregion
    }

    public class CoreContainer : BaseContainer
    {
        public CoreContainer(string dbConnectName)
            : base(dbConnectName)
        {

        }

        #region Example:public DbSet<YourClassName> YourClassName { get; set; }

        #region Table
        public DbSet<User> User { get; set; }

        public DbSet<UserVessel> UserVessel { get; set; }

        public DbSet<SysUser> SysUser { get; set; }

        public DbSet<Report> Report { get; set; }

        public DbSet<ShipInfo> ShipInfo { get; set; }

        public DbSet<Company> Company { get; set; }

        public DbSet<Configs> Configs { get; set; }

        public DbSet<Gallery> Gallery { get; set; }
        #endregion

        #endregion


    }
}
